﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using ATM_Client.Properties;

namespace ATM_Client
{
    public partial class Transfer : Form
    {
        readonly IATM _client = new ATMClient();
        public static string token = "";
        public Transfer()
        {
            InitializeComponent();
        }

        private void TxtReceiverIdTextChanged(object sender, EventArgs e)
        {

        }

        private void BtnDepositClick(object sender, EventArgs e)
        {
            int isSuccess = _client.Transfer(token, txtReceiverId.Text, Convert.ToInt64(txtMoney.Text));
            if (isSuccess == 0)
            {
                MessageBox.Show(Resources.Transfer_btnDeposit_Click_Your_money_was_transfer_to_receiver_successfully_);
                ViewBalance.token = token;
                var form = new ViewBalance();
                form.Show();
                Dispose();
            }
            else
            {
                MessageBox.Show(_client.GetError(isSuccess));
            }
        }

        private void BtnCancleClick(object sender, EventArgs e)
        {
            MainForm.token = token;
            var form = new MainForm();
            form.Show();
            Dispose();
        }
    }
}
